07. Syntax

Syntax

INSTRUCTOR NOTE:

Cam says: whoops, I don't actually have a good link for you at the moment. However, I can explain a little further. Try running this code in your browser.

new Promise(function(resolve) {
  console.log('first');
  resolve();
  console.log('second');
}).then(function() {
  console.log('third');
});

You'll notice that 'first', 'second' and 'third' all get logged. Most notably, 'second' gets logged despite the fact that it comes after resolve().

Around 2:11, I start talking about passing values or undefined through resolve() and reject() to .then and .catch. The values themselves aren't being passed to .then or .catch, rather they're being passed to the functions called by .then or .catch.

Follow me online!

@cwpittman